﻿using System;
using System.Data;
using System.Collections;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

public partial class Show_index : BasicPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string role = GetRole();
            switch (role)
            {
                case "告警查询":
                    SysMenu.Style.Add("display", "none");
                    BasicMenu.Style.Add("display", "none");
                    Page.ClientScript.RegisterStartupScript(GetType(), "query"
                    , "Ext.onReady(function(){window.frames['DqsFrame'].location.href='Report.aspx';});", true);
                    break;
                case "信息管理":
                    SysMenu.Style.Add("display", "none");
                    Page.ClientScript.RegisterStartupScript(GetType(), "query"
                    , "Ext.onReady(function(){window.frames['DqsFrame'].location.href='../Support/Upload.aspx';});", true);
                    break;
                case "系统管理":
                    BasicMenu.Style.Add("display", "none");
                    Page.ClientScript.RegisterStartupScript(GetType(), "admin"
                    , "Ext.onReady(function(){window.frames['DqsFrame'].location.href='../Support/UserManage.aspx';});", true);
                    break;
                default:
                    queryMenu.Style.Add("display", "none");
                    SysMenu.Style.Add("display", "none");
                    BasicMenu.Style.Add("display", "none");
                    DqsFrame.InnerText = "用户角色设置有误，请联系系统管理员！";
                    break;
            }
        }
    }
    protected void LBlogout_Click(object sender, EventArgs e)
    {
        if (Session["LoginUser"] != null)
        {
            log4net.LogManager.GetLogger(GetType()).Info("{ClientIP:'" + BasicPage.GetClientIP() + "',Msg:'" 
                + Session["LoginUser"].ToString() + " logout.'}");
        }
        Session["LoginUser"] = null;
        Response.Redirect("~/UserLogin.aspx");
    }
}
